# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcher do
  @moduledoc """
  Represents a match condition that incoming network traffic is evaluated against.

  ## Attributes

  *   `destIpRanges` (*type:* `list(String.t)`, *default:* `nil`) - Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
  *   `destPorts` (*type:* `list(String.t)`, *default:* `nil`) - Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
  *   `ipProtocols` (*type:* `list(String.t)`, *default:* `nil`) - IPv4 protocol / IPv6 next header (after extension headers). Each element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g. "253-254"), or one of the following protocol names: "tcp", "udp", "icmp", "esp", "ah", "ipip", or "sctp".
  *   `srcAsns` (*type:* `list(integer())`, *default:* `nil`) - BGP Autonomous System Number associated with the source IP address.
  *   `srcIpRanges` (*type:* `list(String.t)`, *default:* `nil`) - Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
  *   `srcPorts` (*type:* `list(String.t)`, *default:* `nil`) - Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
  *   `srcRegionCodes` (*type:* `list(String.t)`, *default:* `nil`) - Two-letter ISO 3166-1 alpha-2 country code associated with the source IP address.
  *   `userDefinedFields` (*type:* `list(GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.t)`, *default:* `nil`) - User-defined fields. Each element names a defined field and lists the matching values for that field.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :destIpRanges => list(String.t()) | nil,
          :destPorts => list(String.t()) | nil,
          :ipProtocols => list(String.t()) | nil,
          :srcAsns => list(integer()) | nil,
          :srcIpRanges => list(String.t()) | nil,
          :srcPorts => list(String.t()) | nil,
          :srcRegionCodes => list(String.t()) | nil,
          :userDefinedFields =>
            list(
              GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.t()
            )
            | nil
        }

  field(:destIpRanges, type: :list)
  field(:destPorts, type: :list)
  field(:ipProtocols, type: :list)
  field(:srcAsns, type: :list)
  field(:srcIpRanges, type: :list)
  field(:srcPorts, type: :list)
  field(:srcRegionCodes, type: :list)

  field(:userDefinedFields,
    as: GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcher do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcher.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.SecurityPolicyRuleNetworkMatcher do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
